package com.zx.framework.file.upload.vo;

import java.io.File;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 分片上传的文件内容,包含文件基本信息,文件分片等内容
 * Created by FLT on 2015/10/10.
 */
public class FileCtx {
    private String fileName;
    private File saveFile;
    private File tmpPath;
    private Long fileCrc32;
    private Long fileSize;
    private Long chunkSize;
    private Date deadline;
    private String bucket;
    private Map<String, File> chunks = new HashMap<>();
    private String ctxKey;
    private String ctxArray;

    public FileCtx(String fileName,File saveFile,File tmpPath, Long fileCrc32, Long fileSize, Long chunkSize,
                   Date deadline, String bucket, String ctxKey) {
        this.fileName = fileName;
        this.saveFile = saveFile;
        this.tmpPath = tmpPath;
        this.fileCrc32 = fileCrc32;
        this.fileSize = fileSize;
        this.chunkSize = chunkSize;
        this.deadline = deadline;
        this.bucket = bucket;
        this.ctxKey = ctxKey;
    }

    public Long getFileSize() {
        return fileSize;
    }

    public void setFileSize(Long fileSize) {
        this.fileSize = fileSize;
    }

    public Long getChunkSize() {
        return chunkSize;
    }

    public void setChunkSize(Long chunkSize) {
        this.chunkSize = chunkSize;
    }

    public Date getDeadline() {
        return deadline;
    }

    public void setDeadline(Date deadline) {
        this.deadline = deadline;
    }

    public String getBucket() {
        return bucket;
    }

    public void setBucket(String bucket) {
        this.bucket = bucket;
    }

    public String getCtxKey() {
        return ctxKey;
    }

    public void setCtxKey(String ctxKey) {
        this.ctxKey = ctxKey;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public Long getFileCrc32() {
        return fileCrc32;
    }

    public void setFileCrc32(Long fileCrc32) {
        this.fileCrc32 = fileCrc32;
    }

    public Map<String, File> getChunks() {
        return chunks;
    }

    public void setChunks(Map<String, File> files) {
        this.chunks = files;
    }

    public String getCtxArray() {
        return ctxArray;
    }

    public void setCtxArray(String ctxArray) {
        this.ctxArray = ctxArray;
    }

    public void putChunk(String ctx, File file) {
        this.chunks.put(ctx, file);
    }

    public File getChunk(String ctx) {
        return this.chunks.get(ctx);
    }

    public File getSaveFile() {
        return saveFile;
    }

    public void setSaveFile(File saveFile) {
        this.saveFile = saveFile;
    }

    public File getTmpPath() {
        return tmpPath;
    }

    public void setTmpPath(File tmpPath) {
        this.tmpPath = tmpPath;
    }
}
